package com.zhongxi.guoyuan.fragment.sliding;


import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;

import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.zhongxi.guoyuan.R;
import com.zhongxi.guoyuan.adapter.rewardCoin.RewardCoinAdapter;
import com.zhongxi.guoyuan.base.BaseFragment;
import com.zhongxi.guoyuan.entity.coinStore.HotGoodsData;
import com.zhongxi.guoyuan.view.rewardCoin.RewardCoinDetailActivity;

import java.util.ArrayList;
import java.util.List;

@SuppressLint("ValidFragment")
public class RewardCoinSlidingFragment extends BaseFragment implements AdapterView.OnItemClickListener {

    private PullToRefreshListView lvList;
    private RewardCoinAdapter adapter;
    private String id;
    List<HotGoodsData> data = new ArrayList<HotGoodsData>();

    /*@Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
        if (isVisibleToUser) {
//            getService();
        }
    }*/

    public RewardCoinSlidingFragment(String id) {
        this.id = id;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_all_sliding, container, false);
    }

    @Override
    protected void initView() {
        super.initView();

        lvList = (PullToRefreshListView) getView().findViewById(R.id.lvList);
        adapter = new RewardCoinAdapter(context, data);
        lvList.setAdapter(adapter);
    }

    @Override
    protected void initEvent() {
        super.initEvent();
        lvList.setOnItemClickListener(this);
    }

    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        startAct(RewardCoinDetailActivity.class);
    }

    public void loadMore() {
    }
}
